import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;

import javax.servlet.jsp.JspFactory;

import weblogic.servlet.jsp.JspFactoryImpl;

import cn.lee.chp2.PrimitiveServlet;
import cn.lee.chp2.Request;
import cn.lee.chp2.Response;


public class JspParserTest {
    public static void main(String[] args) {
        PrimitiveServlet servlet = new PrimitiveServlet();
        Request request = new Request();
        request.setUri("file:D:\\work\\workspaces_webloci_test\\test\\web\\test.jsp");
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        Response response = new Response(baos);
        JspFactory  factory = JspFactory.getDefaultFactory();
        if(factory==null) {
            System.out.println("im getting this error all the time.....");
        }

        javax.servlet.jsp.PageContext pageContext = 
                factory.getPageContext(servlet, request, response, null, true, 8192, true);
        String result = baos.toString();
        System.out.println(result);

    }
}
